from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Canvas

from dryfire.viewModel.targetViewModel import TargetViewModel


class TargetView(Widget):
    """The target view is a canvas where a target is drawn and erased.
    """
    def __init__(self, **kargs):
        Widget.__init__(self, **kargs)
        self.canvas = Canvas()
        self._view_model = TargetViewModel(self)
        self.bind(size=self._view_model.v_handle_on_size)

    @property
    def is_visible(self):
        return self._view_model.visible

    @is_visible.setter
    def is_visible(self, value):
        self._view_model.visible = value
